/******************************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Ltd.                       */
/*                                                                            */
/*  NAME      = zookeeper _common.h                                           */
/*  NOTE      =                                                               */
/*  DATE      = 2015/08/26 by zhengxd                                         */
/******************************************************************************/
#ifndef _ZOOKEEPER_COMMON_H_
#define _ZOOKEEPER_COMMON_H_

#include "zookeeper_core.h"

#define ZOOKEEPER_INT_LEN             4
#define ZOOKEEPER_LONG_LEN            8

unsigned long zookeeper_get_interval_time(struct timeval *p_st_start_time
                                            , struct timeval *p_st_end_time);

void zookeeper_free(char **pp_buffer);

int zookeeper_get_string(Frbyte_Packet *p_st_data
                        , const char *p_key
                        , Frlist_header *p_lst_head);

int zookeeper_skip_string(Frbyte_Packet *p_st_data);

int zookeeper_get_buffer(Frbyte_Packet *p_st_data
                        , const char *p_key
                        , Frlist_header *p_lst_head);

int zookeeper_skip_buffer(Frbyte_Packet *p_st_data);

int zookeeper_skip_id(Frbyte_Packet *p_st_data);

int zookeeper_skip_acl(Frbyte_Packet *p_st_data);

int zookeeper_skip_acl_vector(Frbyte_Packet *p_st_data);

int zookeeper_get_str_vector(Frbyte_Packet *p_st_data
                             , const char *p_key
                             , Frlist_header *p_lst_head);

void zookeeper_init_fragment(L7_fragment_zookeeper *p_st_fragment);

void zookeeper_destroy_fragment(L7_fragment_zookeeper **pp_st_fragment);

void frbindata_node_free(Frlist_node *node);

void zookeeper_destroy_session(L7session_zookeeper **pp_st_sess);

void zookeeper_req_node_free(Frlist_node *p_st_node);

void zookeeper_destroy_req(L7_req_zookeeper **pp_st_req);

void zookeeper_destroy_resp(L7_resp_zookeeper **pp_st_resp);

void zookeeper_init_curr_info(L7session_zookeeper_private *p_st_private);

int zookeeper_report_data(Conntrack *p_st_conn
                          , L7session_zookeeper_private *p_st_private
                          , L7_req_zookeeper *p_st_req
                          , Frhash_header *p_st_hash_report
                          , int i_resp_flg);

#endif
